import java.util.Scanner;

/**
 * Created with intelliJ IDEA.
 * Description:
 * User:常亚洁
 * Date:20250909
 * Time:19:31
 */

public class Test {

    public static void main(String[] args) {
        int n = 7;
        int count = 0;
        while (n != 0) {
            n = n & (n-1);
            count++;
        }
        System.out.println(count);
    }
//求最大公约数
    public static void main7(String[] args) {
        int a = 30;
        int b = 16;
        int c = a % b;
        while (c != 0) {
            a = b;
            b = c;
            c = a % b;
        }
        System.out.println(b);
    }
    public static void main6(String[] args) {
        double sum = 0;
        int flg = 1;
        for (int i = 1; i <= 100; i++) {
            sum = sum + 1.0/i * flg;
            flg = -flg;
        }
        System.out.println(sum);
    }
    public static void main5(String[] args) {
        for (int i = 0; i < 999999; i++) {
            int count = 0;
            int tmp = i;//123
            while (tmp != 0) {
                count++;
                tmp /= 10;
            }
            tmp = i;//123
            int sum = 0;
            while (tmp != 0) {
                sum += Math.pow(tmp % 10,count);
                tmp /= 10;
            }
            if(sum == i) {
                System.out.println(i);
            }
        }
    }
//    判断素数
    public static void main4(String[] args) {
        int n = 5;
        int i = 2;
        for (; i <= Math.sqrt(n); i++) {
            if(n % i == 0) {
                break;
            }
        }
        if(i > Math.sqrt(n)) {
            System.out.println(n +" 是素数！");
        }
    }

//    X图形
public static void main3(String[] args) {
    Scanner in = new Scanner(System.in);
    while (in.hasNextInt()) { // 注意 while 处理多个 case
        int a = in.nextInt();
        for (int i = 0; i < a; i++) {
            for (int j = 0; j < a; j++) {
                if (i == j || i + j == (a - 1)) {
                    System.out.print("*");
                } else {
                    System.out.print(" ");
                }
            }
            System.out.println();
        }
    }
}
public static void main2(String[] args) {
    Scanner scanner=new  Scanner(System.in);
    while(scanner.hasNext()){
   int n=scanner.nextInt();
    System.out.println(n);

}
}
//    1到100的所有出现9的次数
    public static void main1(String[] args) {
        int count=0;
        for (int i = 0; i <= 100; i++) {
            if(i%10==9){
                count++;
        }
            if(i/10==9){
                count++;
            }
    }
        System.out.println(count);
}
}
